package com.decent.ejfadmin.utils;

import com.decent.ejfadmin.common.enums.ErrorCode;
import com.decent.ejfadmin.common.exception.ErrorCodeException;
import org.apache.commons.lang3.StringUtils;

/**
 * describe:参数工具
 *
 * @author 陈豆豆
 * @date 2019/09/07
 */
public class ParamUtil {
    /**
     * 非空参数验证
     *
     * @param params 参数
     */
    public static void verifyRequestParam(Object... params) {
        for (Object param : params) {
            //String 类型
            if (param instanceof String && StringUtils.isBlank(String.valueOf(param))) {
                throw new ErrorCodeException(ErrorCode.PARAM_ERROR);
            }
            if (param == null) {
                throw new ErrorCodeException(ErrorCode.PARAM_ERROR);
            }
        }
    }

}
